package qunar;

/**
 * @Author wyh
 * @Version V1.0.0
 * @Date 2017/8/8
 * @Describe
 */
public enum ProductSource {

    UNKNOWN(0, "unknown", "未知"),
    SELF_SUPPORT(4, "self_support", "自营"),
    EXTERNAL_AGENT(5, "external_agent", "外部代理商"),
    QMALL(6, "qmall", "qmall"),
    COUPON(7, "coupon", "代金券"),
    HOTEL(9,"hotel","酒店券"),
    TRAIN_COUPON(11,"train_coupon","火车票券"),
    TRAIN_HELP_PACKAGE(10,"train_help_package","火车票加速包"),
    DISTRIBUTOR(13, "distributor", "分销商"),
    ACTIVITY(17,"activity","营销活动"),
    TRAIN_ACTIVITY(18,"train_activity","火车票营销活动"),
    HOTEL_ACTIVITY(19,"hotel_activity","酒店营销活动"),
    HOLIDAY_ACTIVITY(20,"holiday_activity","度假营销活动"),
    WEEKEND_ACTIVITY(21,"weekend_activity","周末玩乐活动"),
    AIRLINE_MARKET(22,"airline_market","航司辅营"),
    DAMAI_AGENT(23,"damai_agent","大麦票务"),
    QUNAR_CARD(24,"qunar_card","去哪儿会员"),
    DEFAULT(99,"default","默认"),
    ;


    private int code;
    private String value;
    private String desc;


    public int getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    ProductSource(int code, String value, String desc) {
        this.code = code;
        this.value = value;
        this.desc = desc;
    }

    public static ProductSource codeOf(int code) {
        for (ProductSource each : ProductSource.values()) {
            if (each.code == code) {
                return each;
            }
        }
        return UNKNOWN;
    }

}
